from django.db import models


# Create your models here.


class UserInfo(models.Model):
    username = models.CharField(verbose_name='用户名', max_length=32)
    password = models.CharField(verbose_name='密码', max_length=32)
    email = models.EmailField(verbose_name='邮箱', max_length=32)
    mobile_phone = models.CharField(verbose_name='手机号', max_length=32)

    def __str__(self):
        return self.username


class Project(models.Model):
    """ 项目表 """
    KIND_CHOICES = (
        (1, "科幻片"),
        (2, "动画片"),
        (3, "纪录片"),
        (4, "战争片"),
        (5, "古装片"),
        (6, "喜剧片"),
        (7, "动作片"),
    )

    name = models.CharField(verbose_name='电影名称', max_length=32)
    kind = models.SmallIntegerField(verbose_name='电影种类', choices=KIND_CHOICES, default=1)
    addr = models.CharField(verbose_name='电影资源网址', max_length=300)
    desc = models.CharField(verbose_name='电影简介', max_length=255, null=True, blank=True)
    creator = models.ForeignKey(verbose_name='创建者', to='UserInfo', on_delete=models.CASCADE)
    create_datetime = models.DateTimeField(verbose_name='创建时间', auto_now_add=True)

